package com.rainy.micservice.consumer.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@EnableEurekaClient
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/home")
    public String home() {
        String providerMsg = restTemplate.getForEntity("http://127.0.0.1:10020/demo/home", String.class).getBody();
        System.out.println(providerMsg);
        return "Hello World";
    }

}
